{extend name="admin@index_layout"/}
{block name="main"}
<div class="layui-card">
    <div class="layui-card-header">编辑会员</div>
    <div class="layui-card-body">
        <form class="layui-form" method="post">
        <div class="layui-tab layui-tab-brief">
            <ul class="layui-tab-title">
                <li class="layui-this">基本信息</li>
                <li>其他信息</li>
            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <!-- -->
                    <div class="layui-form-item">
                        <label class="layui-form-label">用户名</label>
                        <div class="layui-input-inline">
                            <input type="text" name="username" lay-verify="required" autocomplete="off" placeholder="用户名" class="layui-input" value="{$data.username}" readonly="readonly">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">昵称</label>
                        <div class="layui-input-inline">
                            <input type="text" name="nickname" lay-verify="required" autocomplete="off" placeholder="昵称" class="layui-input" value="{$data.nickname}">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">邮箱</label>
                        <div class="layui-input-inline">
                            <input type="text" name="email" lay-verify="email|required" autocomplete="off" placeholder="邮箱" class="layui-input" value="{$data.email}">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">手机号</label>
                        <div class="layui-input-inline">
                            <input type="text" name="mobile" lay-verify="mobile|required" autocomplete="off" placeholder="手机号" class="layui-input" value="{$data.mobile}">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">密码</label>
                        <div class="layui-input-inline">
                            <input type="password" name="password" autocomplete="off" placeholder="密码" class="layui-input">
                        </div>
                        <div class="layui-form-mid layui-word-aux">不修改留空即可</div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">确认密码</label>
                        <div class="layui-input-inline">
                            <input type="password" name="password_confirm" autocomplete="off" placeholder="确认密码" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item web_list">
                        <label class="layui-form-label">会员组</label>
                        <div class="layui-input-inline">
                            {php} echo \util\Form::select($groupCache,$data['groupid'], 'name="groupid"', '') {/php}
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">积分点数</label>
                        <div class="layui-input-inline">
                            <input type="text" name="point" lay-verify="required" autocomplete="off" placeholder="积分点数" class="layui-input" value="{$data.point}">
                        </div>
                        <div class="layui-form-mid layui-word-aux"> 请输入积分点数，积分点数将影响会员用户组</div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">vip会员</label>
                        <div class="layui-input-inline">
                            <input type="radio" name="vip" value="1" title="是" {if $data.vip == 1}checked{/if}>
                            <input type="radio" name="vip" value="0" title="否" {if $data.vip == 0}checked{/if}>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">过期时间</label>
                        <div class="layui-input-inline">
                            <input type="text" name="overduedate" class="layui-input" id="overduedate" value="{neq name='data.overduedate' value='0'}{$data.overduedate}{/neq}">
                        </div>
                    </div>
                    <!-- -->
                </div>
                <div class="layui-tab-item">
                    <div class="layui-form-item">
                        <label class="layui-form-label">头像</label>
                        <div class="layui-input-inline w350">
                            <input type="text" name="avatar" id="avatar" placeholder="头像" class="layui-input" value="{$data.avatar}">
                        </div>
                        <div class="layui-input-inline">
                            <button class="layui-btn layui-btn-normal js-btn-upload" type="button" data-for-imgid="img-avatar" data-for-elemid="avatar" data-callback="uploadImgSuccess">上传头像</button>
                            <img src="{$data.avatar}" id="img-avatar" class="preview-img" width="40" height="40" style="margin-left:5px;cursor:pointer">
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-elem">
            <input type="hidden" name="id" value="{$data.id}">
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="formSubmit">立即提交</button>
                    <button class="layui-btn layui-btn-normal" type="button" onclick="javascript:history.back(-1);">返回</button>
                </div>
            </div>
        </div>
        </form>
    </div>
</div>
{/block}
{block name="script"}
<script src="__STATIC__/libs/jquery-plugins/jquery.previewImage.js"></script>
<script src="__STATIC__/admin/js/form.js"></script>
<script>
// laydate控件
$.layui.laydate({
    elem: '#overduedate'
    ,type: 'datetime'
    ,isInitValue: false
});

$(function () {
    $('.preview-img').previewImage();
});

function uploadImgSuccess(res, item) {
    //console.log(res);
}
</script>
{/block}